package com.realtyreg.service.form;

import org.hibernate.validator.constraints.Email;
import com.realtyreg.service.validator.EnumField;
import com.realtyreg.service.validator.FieldMatch;

import javax.validation.Valid;

/**
 * Форма для регистрации
 * Created by Petro 18.11.12 2:44
 */
@FieldMatch.List({
        @FieldMatch(first = "email", second = "confirmEmail", message = "{FieldMatch.registration.email.not.match}")
})
public class Registration {
    @Email(regexp = "^[\\w-.]+@[\\w-.]+\\.[\\w]{2,3}$")
    private String email;

    @Email(regexp = "^[\\w-.]+@[\\w-.]+\\.[\\w]{2,3}$")
    private String confirmEmail;

    @Valid
    PasswordForm passwordForm;

    @EnumField(values = {"INDIVIDUAL", "AGENCY"})
    private String role;

    //валидируется NameValidator-ом
    NameForm nameForm;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getConfirmEmail() {
        return confirmEmail;
    }

    public void setConfirmEmail(String confirmEmail) {
        this.confirmEmail = confirmEmail;
    }

    public PasswordForm getPasswordForm() {
        return passwordForm;
    }

    public void setPasswordForm(PasswordForm passwordForm) {
        this.passwordForm = passwordForm;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public NameForm getNameForm() {
        return nameForm;
    }

    public void setNameForm(NameForm nameForm) {
        this.nameForm = nameForm;
    }
}
